package rest.jbpm.wrappers.lists;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jbpm.api.history.HistoryComment;
import rest.jbpm.wrappers.Comment;

@XmlRootElement
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlType(name = "comments", propOrder = {"comments"})
public class CommentList {

	private List<Comment> comments;
	
	protected CommentList() {
		
	}
	
	public CommentList(Collection<? extends HistoryComment> cms) {
		
		comments = new ArrayList<Comment>();
		
		for(HistoryComment cm : cms)
			comments.add(new Comment(cm));

	}
	
	@XmlElement(name="comment" , required=true)
	public List<Comment> getComments() {
		return comments;
	}
}

